package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import model.GameManager;
import view.MenuButton;
import view.UserInterface;

/**
 * Recebe qual tipo de jogo foi escolhido na tela de menu e dá início ao jogo.
 */
public class MenuListener implements ActionListener {

	@Override
	public void actionPerformed(ActionEvent e) {
		GameManager game = GameManager.getInstance();
		Main.playersMenu.dispose();
		Main.userInterface = new UserInterface(game.getBoard().getRows(), 
				game.getBoard().getCols(), Main.playerListener);
		game.startGame(((MenuButton) e.getSource()).getType());
	}

}
